﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Kaskelot.SP.Model.Contracts;
using Kaskelot.SP.Services;
using Stockholm.SOA.Kaskelot.WCF.DataContracts;

namespace Kaskelot.SP.UI.CONTROLTEMPLATES.Kaskelot.SP.UI.Forms
{
	public partial class BemanningValdistriktForm : BaseForm, IForm
	{
		public string Id { get; set; }
		public string ParentId { get; set; }

		protected void Page_Load(object sender, EventArgs e)
		{
			if (Page.IsPostBack) return;

			using (BemanningService svc = new BemanningService())
			{
				var f = svc.GetFunktioner().OrderBy(funk => funk.Beskrivning);

				List<ListItem> funktioner = new List<ListItem>();
				foreach (Funktion v in f)
				{
					funktioner.Add(new ListItem() { Text = v.Beskrivning, Value = v.Id.ToString() });
				}
				FunktionRepeater.DataSource = funktioner;
				FunktionRepeater.DataBind();
			}
		}
	}
}
